package com.nine.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nine.dao.UsersMapper;
import com.nine.entity.Permission;
import com.nine.entity.Users;
import com.nine.entity.UsersWithBLOBs;
import com.nine.service.UsersService;
@Service
public class UsersServiceImpl implements UsersService {
	@Autowired
	private UsersMapper usersMapper;

	@Override
	public List<UsersWithBLOBs> getAllUsers() {
		return usersMapper.getAllUsers();
	}

	/**
	 * 添加用户
	 */
	@Override
	public int insert(UsersWithBLOBs record) {
		// TODO Auto-generated method stub
		return usersMapper.insert(record);
	}
	
	//多项删除用户
	@Override
	public int delMoreUsers(Integer[] ids) {
		// TODO Auto-generated method stub
		return usersMapper.delMoreUsers(ids);
	}
	
	//通过主键查单条
	@Override
	public UsersWithBLOBs selectByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return usersMapper.selectByPrimaryKey(id);
	}
	
	//有选择性的修改用户实体，非空即改
	@Override
	public int updateByPrimaryKeySelective(UsersWithBLOBs record) {
		// TODO Auto-generated method stub
		return usersMapper.updateByPrimaryKeySelective(record);
	}

	
	//通过条件模糊查询来搜索用户
	@Override
	public List<UsersWithBLOBs> getUsersByCondition(String username) {
		// TODO Auto-generated method stub
		return usersMapper.getUsersByCondition(username);
	}
	
	//登录	通过用户名来获取密码
	@Override
	public String getPwdByUname(String username) {
		// TODO Auto-generated method stub
		return usersMapper.getPwdByUname(username);
	}
	
	
	//根据用户名来获取其权限
	@Override
	public List<Permission> getPermissionByUname(String username) {
		// TODO Auto-generated method stub
		return usersMapper.getPermissionByUname(username);
	}
	
	
	//根据用户名来获取本人信息
	@Override
	public UsersWithBLOBs getInfoByUname(String username) {
		// TODO Auto-generated method stub
		return usersMapper.getInfoByUname(username);
	}
	
	//根据用户名来修改本人密码
	@Override
	public int updateCurrentlogCodeByUsername(String username, String logcode) {
		// TODO Auto-generated method stub
		return usersMapper.updateCurrentlogCodeByUsername(username, logcode);
	}

}
